#import "./user.fragment.graphql"

query searchUsers($fullPath: ID!, $search: String, $isProject: Boolean = false) {
  group(fullPath: $fullPath) @skip(if: $isProject) {
    id
    groupMembers(search: $search, relations: [DIRECT, INHERITED, SHARED_FROM_GROUPS]) {
      nodes {
        id
        user {
          ...User
        }
      }
    }
  }
  project(fullPath: $fullPath) @include(if: $isProject) {
    id
    projectMembers(
      search: $search
      relations: [DIRECT, INHERITED, INVITED_GROUPS, SHARED_INTO_ANCESTORS]
    ) {
      nodes {
        id
        user {
          ...User
        }
      }
    }
  }
}
